package com.chat.datea.acitivity;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.chat.datea.R;

/**
 * Created by 周橹 on 15/11/2.
 */
public class FeedbackActivity extends Activity implements View.OnClickListener {

    private String edit;
    private Handler handler;
    private ImageView feedback_back;
    private EditText feedback_editText;
    private TextView send_message;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);

        feedback_back = (ImageView) findViewById(R.id.feedback_back);
        send_message = (TextView) findViewById(R.id.send_message);
        feedback_editText = (EditText) findViewById(R.id.feedback_editText);

        feedback_back.setOnClickListener(this);
        send_message.setOnClickListener(this);

        handler = new Handler();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.feedback_back:
                finish();
                break;
            case R.id.send_message:
                edit = feedback_editText.getText().toString();
                if (! edit.equals("")) {
                    Toast.makeText(this, "提交成功，感谢您提交的反馈!", Toast.LENGTH_SHORT).show();
                    handler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            finish();
                        }
                    }, 1500);
                } else {
                    Toast.makeText(this, "请填写反馈信息，谢谢您的支持!", Toast.LENGTH_SHORT).show();

                }
                break;
            default:
                break;
        }
    }
}
